const mongoose = require("mongoose");
const Schema = mongoose.Schema;

// 实例化数据模板
const ProfileSchema = new Schema({
  user: { // 关数据联表
    type: String,
    ref: "users",
    require: true
  },
  // 用户标识
  handle: {
    type: String,
    require: true,
    max: 40
  },
  company: {
    type: String,
  },
  location: {
    type: String,
  },
  status: {
    type: String,
    require: true
  },
  skills:{
    type:[String],
    require:true
  },
  educations: [{
    current: {
      type: Boolean,
      default: true,
    },
    school: {
      type: String,
      required: true
    },
    degree: {
      type: String,
    }
  }],
  social:{
    wechat: {
      type: String,
    },
    QQ: {
      type: String,
    },
  },
  date: {
    type: Date,
    default: Date.now
  },
})

module.exports = Profile = mongoose.model("profile", ProfileSchema);